package RDFManager;

import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.riot.RDFDataMgr;

import javax.swing.*;
import java.io.File;

public class RDFFileReader {
  public static Model readRDFFile(){
    File selectedFile = FileReader.readFile();
    if(selectedFile != null){
      return createModel(selectedFile);
    }
    return null;
  }
  private static Model createModel(File file){
    Model model = ModelFactory.createDefaultModel();
    RDFDataMgr.read(model, file.getAbsolutePath());
    return model;
  }
}
